﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Workflow.Activities;
using System.Workflow.Runtime;
using TakeoutExpress.Support.Linq;
namespace DeliveryBoy.Workflow.Interfaces
{
    /// <summary>
    /// The workflow provides the actual "flow", it should be somewhat dumb in "where" a takeout user or takeout provider ID 
    /// comes from, just that the service it is talking to provides it.  
    /// </summary>
    [ExternalDataExchange]
    public interface ITakeoutProviderWorkflow
    {
        // events to allow a service to talk to the workflow
        event EventHandler<TakeoutUserCreatedEventArgs> CreateTakeoutUserEvent;
        event EventHandler<TakeoutProviderCreatedEventArgs> CreateTakeoutProviderEvent;
        event EventHandler<TakeoutProviderCancelEventArgs> CancelTakeoutProviderEvent;
        event EventHandler<TakeoutUserCancelEventArgs> CancelTakeoutUserEvent;

        // methods to allow the workflow to talk to the service.
        void OnTakeoutProviderCreated(TakeoutProviderCreatedEventArgs e);
        void OnTakeoutUserCreated(TakeoutUserCreatedEventArgs e);
        void OnTakeoutProviderClosed(TakeoutUserCreatedEventArgs e);
        void OnTakeoutUserNotified(TakeoutUserNotifiedEventArgs e);
        void OnTakeoutProviderCanceled(TakeoutProviderCancelEventArgs e);
        void OnTakeoutUserCanceled(TakeoutUserCancelEventArgs e);

    }
    /// <summary>
    /// moving the necessary arguments into the event args to make it so the workflow tier is completly
    /// uncoupled from the dataContext.  I'll let services handle that.  
    /// </summary>
    [Serializable()]
    public class TakeoutProviderCreatedEventArgs : ExternalDataEventArgs
    {

        #region private declarations
        private int _siteId;
        private bool _allowPayMeLater;
        private DateTime _expirationTime;
        private DateTime _startTime;
        private IEnumerable<Audience> _audiences;
        private int _maximumOrders;
        private bool _notified;
        private string _instructions;
        private decimal _takeoutCharge;
        
        #endregion

        #region public accessors
        public DateTime StartTime
        {
            get { return _startTime; }
            set { _startTime = value; }
        }
        public DateTime ExpirationTime
        {
            get { return _expirationTime; }
            set { _expirationTime = value; }
        }
        public bool AllowPayMeLater
        {
            get { return _allowPayMeLater; }
            set { _allowPayMeLater = value; }
        }
        public string Instructions
        {
            get { return _instructions; }
            set { _instructions = value; }
        }
        public int MaximumOrders
        {
            get { return _maximumOrders; }
            set { _maximumOrders = value; }
        }
        public bool Notified
        {
            get { return _notified; }
            set { _notified = value; }
        }
        public decimal TakeoutCharge
        {
            get { return _takeoutCharge; }
            set { _takeoutCharge = value; }
        }
        public int SiteId
            {
                get { return _siteId; }
                set { _siteId = value; }
            }
        #endregion
           
        public TakeoutProviderCreatedEventArgs(Guid instanceId)
            : base(instanceId)
        { 
            
         
          
        }
    }
    [Serializable()]
    public class TakeoutUserCreatedEventArgs : ExternalDataEventArgs
    {
        public TakeoutUserCreatedEventArgs(Guid instanceId)
            : base(instanceId)
        {
        }
    }
    [Serializable()]
    public class TakeoutUserNotifiedEventArgs : ExternalDataEventArgs 
    {
        public TakeoutUserNotifiedEventArgs(Guid instanceId)
            : base(instanceId)
        {

        }
    }
    [Serializable()]
    public class TakeoutProviderClosedEventArgs : ExternalDataEventArgs 
   {
       public TakeoutProviderClosedEventArgs(Guid instanceId)
           : base(instanceId)
       {

       }
   }
    [Serializable()]
    public class TakeoutProviderCancelEventArgs : ExternalDataEventArgs
    {
        public TakeoutProviderCancelEventArgs(Guid instanceId)
            : base(instanceId)
        {
        }
    }
    [Serializable()]
    public class TakeoutUserCancelEventArgs : ExternalDataEventArgs 
    {
        public TakeoutUserCancelEventArgs(Guid instanceId)
            : base(instanceId)
        {

        }
    }
}
